package www.openteam.com.adapter;

import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import www.openteam.com.R;
import www.openteam.com.bean.DlryNtPrimaryTable;
import www.openteam.com.bean.DlryNtSublist;

/**
 * Created by Administrator on 2019-07-26.
 */

public class DeliverNoteAdp extends RecyclerView.Adapter<DeliverNoteAdp.ViewHolder> {

    Context context;
    List<DlryNtSublist.DataBeanX.DataBean> dataBeanList = new ArrayList<>();


    public DeliverNoteAdp(Context context, List<DlryNtSublist.DataBeanX.DataBean> dataBeanList) {
        this.context = context;
        this.dataBeanList = dataBeanList;
        int size = dataBeanList.size();
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_dlrynote_sublist, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        DlryNtSublist.DataBeanX.DataBean dataBean = dataBeanList.get(position);
        holder.itemDlryntSblstCustID.setText(dataBean.getCustorderno());
        holder.itemDlryntSblstCstMtrlID.setText(dataBean.getCustMaterialID());
        holder.itemDlryntSblstPrdstNme.setText(dataBean.getName());
        holder.itemDlryntSblstSndNmb.setText(dataBean.getSendnumb());
    }

    @Override
    public int getItemCount() {
        return dataBeanList.size();
    }

    static class ViewHolder extends RecyclerView.ViewHolder {
        @Bind(R.id.item_dlrynt_sblst_custID)
        TextView itemDlryntSblstCustID;
        @Bind(R.id.item_dlrynt_sblst_CstMtrlID)
        TextView itemDlryntSblstCstMtrlID;
        @Bind(R.id.item_dlrynt_sblst_prdstNme)
        TextView itemDlryntSblstPrdstNme;
        @Bind(R.id.item_dlrynt_sblst_sndNmb)
        TextView itemDlryntSblstSndNmb;
        @Bind(R.id.lineitem)
        LinearLayout lineitem;
        @Bind(R.id.a_card)
        CardView aCard;

        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
